<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../../../attr.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${ctx}/css/sapar.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/kkpager_blue.css" />
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/sapar.js"></script>
<script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
<script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/js/kkpager.min.js"></script>
<script type="text/javascript" src="${ctx}/assets/laydate/laydate.js"></script>
<script type="text/javascript" src="${ctx}/js/mask.js"></script>
<title>测试过程</title>
<style type="text/css">
th{
text-align: center;
}
td{
text-align: center;
}
</style>
</head>
<body>
<div id="mask" class="mask"></div>
<div id="left">
	<div id="saper-container">
        <div id="saper-bd">
            <div class="subfiled clearfix">
                <h2>测试过程</h2>
            </div>
            <div class="subfiled-content">
                <!--表格开始-->
                <form action="" id="ceshiJieshu">
                <div id="table_left" class="table">
                    <!--表格具体内容-->
                    <a href="javascript:;" class="sapar-btn sapar-btn-recom" id="end" >结束测试</a>
                    <div class="table-box">
                        <table>
                            <thead>
                                <tr>
                                    <th><input type="checkbox" id="checkall" name="checkall"/></th>
                                    <th>测试流水</th>
                                    <th>测试机器</th>
                                    <th>测试软件</th>
                                    <th>测试人</th>
                                    <th>测试开始时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:if test="${lstCeshi != null}">
									<!-- var 是给给他起名字 -->
									<c:forEach items="${lstCeshi}" var="ceshi">
										<tr class="ceshiData">
										    <td>
											<input type="checkbox" name="ceshiLiushui"
												value=${ceshi.ceshiLiushui } />
											</td>
											<td>${ceshi.ceshiLiushui }</td>
											<td>${ceshi.equip.equipName}</td>
											<td>${ceshi.ceshiSoft}</td>
											<td>${ceshi.employee.employeeName}</td>
											<td><fmt:formatDate value="${ceshi.ceshiKaishiTime}"
													type="date" pattern="yyyy-MM-dd HH:mm:ss" /></td>
										</tr>
									</c:forEach>
								</c:if>
                                 
                            </tbody>
                        </table>
                    </div>
                </div><!--表格结束-->
                </form>
	        </div>
         </div>
	</div>
</div>
        <div id="saper-ft">
        	<div id="kkpager"></div>
        </div>
        


    
   
<script type="text/javascript">

function getSelRecord(){
	var chk_value =[];
   $('input[name="ceshiLiushui"]:checked').each(function(){
		chk_value.push($(this).val()); 
	});
	return chk_value;
}

function getParameter(name) { 
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r!=null) return unescape(r[2]); return null;
}

				
		
		$(function(){
			
			var totalPage = ${total};
	    	var pageNo = getParameter('pageIndex');
	    	if(!pageNo){
	    		pageNo = 1;
	    	}
	    	kkpager.generPageHtml({
	    		pno : pageNo,
	    		//总页码
	    		total : totalPage,
	    		//链接前部
	    		hrefFormer : '${ctx}/miejun/bdCeshiShenhe',
	    		//链接尾部
	    		hrefLatter : '.do',
	    		getLink : function(n){
	    			return this.hrefFormer + this.hrefLatter + "?pageIndex="+n+"&searchTxt="+$(".search_text").val();
	    		}
	    	});
			
			$("#end").click(function(){
				var chk_value = getSelRecord();
				if(chk_value.length>0){
					showMask();
					$.ajax({
					type:"post",
					url:"${ctx}/miejun/endCeshi.do?id="+chk_value.join(),
					error:function(){
						layer.alert("网络故障，稍后再试");
					},
					success:function(data){
						$("#mask").hide();
						if(data.state=="true"){
							layer.alert("保存成功",function(){
								 window.location.reload();
							 });
		 	           	}else{
		 	           		 layer.alert(data.msg);
		 	           	}
					}
				    });
				}
				else{
					layer.alert("请先选择数据！");
				}
			});
			
			$("#checkall").click(function(){
	   		    if(this.checked){
	   		        $("input[name='ceshiLiushui']").prop('checked', true)
	   		    }else{
	   		        $("input[name='ceshiLiushui']").prop('checked', false)
	   		    }
		    });
		});
</script>
</body>
</html>